<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
if (window.internals)
  internals.settings.setEditingBehavior('win');

selection_test(
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  '3-0 left word');

selection_test(
  '<div contenteditable dir="ltr">a|bc def <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  '3-1 left word');

selection_test(
  '<div contenteditable dir="ltr">ab|c def <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  '3-2 left word');

selection_test(
  '<div contenteditable dir="ltr">abc| def <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  '3-3 left word');

selection_test(
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def <span>hij opq</span> rst uvw</div>',
  '3-4 left word');

selection_test(
  '<div contenteditable dir="ltr">abc d|ef <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  '3-5 left word');

selection_test(
  '<div contenteditable dir="ltr">abc de|f <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  '3-6 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def| <span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  '3-7 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def |<span>hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  '3-8 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>|hij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def <span>hij opq</span> rst uvw</div>',
  '3-9 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>h|ij opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |<span>hij opq</span> rst uvw</div>',
  '3-10 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hi|j opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |<span>hij opq</span> rst uvw</div>',
  '3-11 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij| opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |<span>hij opq</span> rst uvw</div>',
  '3-12 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |<span>hij opq</span> rst uvw</div>',
  '3-13 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij o|pq</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  '3-14 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij op|q</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  '3-15 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq|</span> rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  '3-16 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span>| rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  '3-17 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> |rst uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij |opq</span> rst uvw</div>',
  '3-18 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> r|st uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> |rst uvw</div>',
  '3-19 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rs|t uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> |rst uvw</div>',
  '3-20 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst| uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> |rst uvw</div>',
  '3-21 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst |uvw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> |rst uvw</div>',
  '3-22 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst u|vw</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst |uvw</div>',
  '3-23 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst uv|w</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst |uvw</div>',
  '3-24 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst uvw|</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def <span>hij opq</span> rst |uvw</div>',
  '3-25 left word');
</script>
